css: Add _gtk_css_style_property_get_mask_affecting()
authorBenjamin Otte <otte@redhat.com>
Tue, 27 Jan 2015 03:47:55 +0000 (04:47 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 27 Jan 2015 04:04:34 +0000 (05:04 +0100)
Computes a bitmask for all properties that affect the given flags.

gtk/gtkcssstyleproperty.c
gtk/gtkcssstylepropertyprivate.h

index 4d04dc76f99e0000c4867218c8895fb97c461f4f..55da7d17de9eea1938f84f80c53f03b0f9cf1842 100644 (file)
@@ -406,6 +406,35 @@ _gtk_css_style_property_get_initial_value (GtkCssStyleProperty *property)
   return property->initial_value;
 }
 
+/**
+ * _gtk_css_style_property_get_mask_affecting:
+ * @flags: the flags that are affected
+ *
+ * Computes a bitmask for all properties that have at least one of @flags
+ * set.
+ *
+ * Returns: (transfer: full): A #GtkBitmask with the bit set for every
+ *          property that has at least one of @flags set.
+ */
+GtkBitmask *
+_gtk_css_style_property_get_mask_affecting (GtkCssAffects affects)
+{
+  GtkBitmask *result;
+  guint i;
+
+  result = _gtk_bitmask_new ();
+
+  for (i = 0; i < _gtk_css_style_property_get_n_properties (); i++)
+    {
+      GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (i);
+
+      if (_gtk_css_style_property_get_affects (prop) & affects)
+        result = _gtk_bitmask_set (result, i, TRUE);
+    }
+
+  return result;
+}
+
 gboolean
 _gtk_css_style_property_changes_affect_size (const GtkBitmask *changes)
 {
index 47cd0516db117b17b7f1c55044d1376f9c4ca2a4..fbc84897497da3058122b87f8f9b1002400ce906 100644 (file)
@@ -83,6 +83,8 @@ void                    _gtk_css_style_property_print_value     (GtkCssStyleProp
                                                                  GtkCssValue            *value,
                                                                  GString                *string);
 
+GtkBitmask *            _gtk_css_style_property_get_mask_affecting
+                                                                (GtkCssAffects           affects);
 gboolean                _gtk_css_style_property_changes_affect_size
                                                                 (const GtkBitmask       *changes);
 gboolean                _gtk_css_style_property_changes_affect_font